<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <style>
        </style>
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <!-- BANNER -->
            <p:layoutUnit position="north" id="menu">
                <ui:include src="../basic/banner.xhtml" />
            </p:layoutUnit>
            <!-- MENU -->
            <p:layoutUnit position="west">
                <ui:include src="../basic/menu.xhtml" />
            </p:layoutUnit>
            <!-- CONTENT -->
            <h:form>
                <p:layoutUnit position="center">
                    <p:dataTable var="patient"
                                 value="#{patientManagerBean.patientDataModel}" paginator="true"
                                 rows="10" selection="#{patientManagerBean.selectedPatient}"
                                 selectionMode="single">

                        <p:ajax event="rowSelect"
                                update=":modalConsultPatient"
                                oncomplete="dlgConsultPatient.show();" />

                        <f:facet name="header">Patient List</f:facet>
                        <p:column headerText="Firstname">#{patient.firstName}</p:column>
                        <p:column headerText="LastName">#{patient.lastName}</p:column>
                        <p:column headerText="Priority">#{patient.priority}</p:column>
                        <p:column headerText="Address">#{patient.address}</p:column>
                    </p:dataTable>
                </p:layoutUnit>
            </h:form>
        </p:layout>

        <!-- Consult Patient Modal -->
        <p:dialog id="modalConsultPatient" header="Patient Information"
                  widgetVar="dlgConsultPatient" modal="true">
            <h:form>

                <p:tabView orientation="left">
                    <p:tab title="Patient informations">
                        <p:panelGrid columns="2">
                            <h:outputText value="First name " />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.firstName}" />
                            <h:outputText value="Last name " />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.lastName}" />
                            <h:outputText value="Birthday " />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.birthday}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:outputText>
                            <h:outputText value="SSID " />
                            <h:outputText value="#{patientManagerBean.selectedPatient.ssid}" />
                            <h:outputText value="Phone " />
                            <h:outputText value="#{patientManagerBean.selectedPatient.phone}" />
                            <h:outputText value="Address " />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.address}" />
                            <h:outputText value="Priority " />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.priority}" />
                        </p:panelGrid>
                    </p:tab>
                    <p:tab title="Your Doctor">
                        <p:panelGrid columns="2">
                            <h:outputText value="First name" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.firstName}" />
                            <h:outputText value="Last name" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.lastName}" />
                            <h:outputText value="Birthday" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.birthday}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:outputText>
                            <h:outputText value="SSID" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.ssid}" />
                            <h:outputText value="Phone" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.phone}" />
                            <h:outputText value="Address" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.medecin.adress}" />
                        </p:panelGrid>
                    </p:tab>
                    <p:tab title="Your Laboratory">
                        <p:panelGrid columns="2">
                            <h:outputText value="Name" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.laboratory.name}" />
                            <h:outputText value="Phone" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.laboratory.phone}" />
                            <h:outputText value="Address" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.laboratory.adress}" />
                        </p:panelGrid>
                    </p:tab>
                    <p:tab title="Your Pharmacy">
                        <p:panelGrid columns="2">
                            <h:outputText value="Name" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.pharmacie.name}" />
                            <h:outputText value="Phone" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.pharmacie.phone}" />
                            <h:outputText value="Address" />
                            <h:outputText
                                value="#{patientManagerBean.selectedPatient.pharmacie.adress}" />
                        </p:panelGrid>
                    </p:tab>
                    <p:tab title="Your Disponibility">
                        <p:panelGrid columns="2">
                            <h:outputText value="Monday" />
                            <p:selectOneRadio
                                value="#{patientManagerBean.selectedPatient.monday}">
                                <f:selectItem itemLabel="No" itemValue="-1" />
                                <f:selectItem itemLabel="From 8h" itemValue="0" />
                                <f:selectItem itemLabel="From 10h" itemValue="1" />
                                <f:selectItem itemLabel="From 14h" itemValue="2" />
                                <f:selectItem itemLabel="From 16h" itemValue="3" />
                            </p:selectOneRadio>
                            <h:outputText value="Tuesday" />
                            <p:selectOneRadio
                                value="#{patientManagerBean.selectedPatient.tuesday}">
                                <f:selectItem itemLabel="No" itemValue="-1" />
                                <f:selectItem itemLabel="From 8h" itemValue="0" />
                                <f:selectItem itemLabel="From 10h" itemValue="1" />
                                <f:selectItem itemLabel="From 14h" itemValue="2" />
                                <f:selectItem itemLabel="From 16h" itemValue="3" />
                            </p:selectOneRadio>
                            <h:outputText value="Wednesday" />
                            <p:selectOneRadio
                                value="#{patientManagerBean.selectedPatient.wednesday}">
                                <f:selectItem itemLabel="No" itemValue="-1" />
                                <f:selectItem itemLabel="From 8h" itemValue="0" />
                                <f:selectItem itemLabel="From 10h" itemValue="1" />
                                <f:selectItem itemLabel="From 14h" itemValue="2" />
                                <f:selectItem itemLabel="From 16h" itemValue="3" />
                            </p:selectOneRadio>
                            <h:outputText value="Thursday" />
                            <p:selectOneRadio
                                value="#{patientManagerBean.selectedPatient.thursday}">
                                <f:selectItem itemLabel="No" itemValue="-1" />
                                <f:selectItem itemLabel="From 8h" itemValue="0" />
                                <f:selectItem itemLabel="From 10h" itemValue="1" />
                                <f:selectItem itemLabel="From 14h" itemValue="2" />
                                <f:selectItem itemLabel="From 16h" itemValue="3" />
                            </p:selectOneRadio>
                            <h:outputText value="Friday" />
                            <p:selectOneRadio
                                value="#{patientManagerBean.selectedPatient.friday}">
                                <f:selectItem itemLabel="No" itemValue="-1" />
                                <f:selectItem itemLabel="From 8h" itemValue="0" />
                                <f:selectItem itemLabel="From 10h" itemValue="1" />
                                <f:selectItem itemLabel="From 14h" itemValue="2" />
                                <f:selectItem itemLabel="From 16h" itemValue="3" />
                            </p:selectOneRadio>
                        </p:panelGrid>
                    </p:tab>
                </p:tabView>
            </h:form>
        </p:dialog>

    </h:body>
</html>